Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Zoom label not updating on selection/input #389

Merged
merged 5 commits into from
Feb 7, 2024
Merged

fix: Zoom label not updating on selection/input #389

merged 5 commits into from
Feb 7, 2024

Conversation

Shahidullah-Muffakir
Copy link
Contributor

### Issue:

This pull request addresses the issue where the zoom label next to the zoom dropdown and input field does not update to reflect the selected zoom level (Issue #388 ).

Description:

This PR implements a fix that ensures the zoom label accurately displays the chosen zoom level, regardless of whether it's selected from the dropdown or entered in the input field.

Changes:

Added a code block that dynamically updates the viewport in real-time as the user adjusts the zoom level.
Because we are displaying the zoomFactor propery of viewport in the zoom label which was not updating

This enhancement ensures immediate synchronization between the user's zoom actions and the displayed viewport. Prior to this update, the viewport did not reflect changes in zoom levels promptly, resulting in the display of outdated information on the zoom label.

@AykutSarac
Copy link
Owner

Good job! There's one issue remaining though, if we zoom in/out within the graph it's still showing incorrect value.

@Shahidullah-Muffakir
Copy link
Contributor Author

Got it, will look into it.

@Shahidullah-Muffakir
Copy link
Contributor Author

Hi AykutSarac,

I've investigated the issue with the zoom label not updating correctly when zooming within the graph. I've made some changes to address this.

Could you please take a look at the updated commit and let me know if this resolves the issue?

Thanks,

@Shahidullah-Muffakir
Copy link
Contributor Author

  1. Fixed bug where zoom level label was not updating when using regular mouse wheel to zoom. It previously only updated on ctrl + wheel zoom. Now consistently updates on all zoom interactions.

  2. Added debouncing of 300ms to zoom change handler. This limits how often the zoom level state and label are updated when user is quickly scrolling. Improves performance.

  3. Zoom level state is now properly set whether user is zooming with ctrl or regular scroll. Resolved inconsistent behavior.

@AykutSarac AykutSarac linked an issue Feb 7, 2024 that may be closed by this pull request
src/store/useGraph.ts Outdated Show resolved Hide resolved
@AykutSarac AykutSarac merged commit d5482cd into AykutSarac:main Feb 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: Zoom Label Not Updating After Selection or Input
2 participants